// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"

/**
 * 
 */
DECLARE_LOG_CATEGORY_EXTERN(TestLog, Verbose, All);

class MISCELLANEOUSPROJECT_API Test1
{
public:
	Test1();

	void TestPring();
	~Test1();
};


class ClassBase
{
public:
	int32 nBase;
};

class ClassTop : public ClassBase
{
public:
	ClassTop():Only(0){};
	ClassTop(int32 N):Only(N){};
	void MyFunc();
	int32 Only;
};

class TestManager
{
public:
	TestManager();
	~TestManager();

	// 智能指针
	class SharePtr
	{
	public:
		// 创建一个TSharePtr
		void CreateSharePtr();
	
		// TSharePtr转TSharePtr
		void SharePtrToSharePtr();

		// Const TSharePtr转TSharePtr
		void ConstSharePtrToSharePtr();

		// TSharePtr转TShareRef
		void SharePtrToShareRef();
	};

	// 智能引用
	class ShareRef
	{
	public:
		// 创建一个TShareRef
		void CreateShareRef();
	
		// TShareRef转TShareRef
		void ShareRefToShareRef();

		// Const TShareRef转TShareRef
		void ConstShareRefToShareRef();

		// TShareRef转TSharePtr
		void ShareRefToSharePtr();
	};

	// 弱指针
	class WeakPtr
	{
	public:
		// 创建一个TWeakPtr
		void CreateWeakPtr();
		
		// TWeakPtr转TSharePtr
		void WeakPtrToSharePtr();

		// TWeakPtr转TShareRef
		void WeakPtrToShareRef();
	};

	class ClassParent : public TSharedFromThis<ClassParent>
	{
	public:
		int32 TempNumber;
	};

	class ClassChidren : public ClassParent
	{
	public:
		int32 ChildrenNum;
	};

	// 继承自TSharedFromThis的类可以将普通指针转化为智能指针
	void SharedFromThisTest();
};